<?php

namespace App\Models;

use App\Models\Traits\ProjectTrait;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\Column
 *
 * @property int $id
 * @property int $project_id 项目ID
 * @property int $prev_id 上一列
 * @property int $next_id 下一列
 * @property string $title 列名
 * @property string $description 描述信息
 * @property int $frozen 是否冻结
 * @property int $hidden 是否隐藏
 * @property int $type 列类型
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column whereDescription($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column whereFrozen($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column whereHidden($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column whereNextId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column wherePrevId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column whereProjectId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column whereTitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column whereType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Column whereUpdatedAt($value)
 * @mixin \Eloquent
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Cell[] $cells
 * @property-read int|null $cells_count
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ColumnMeta[] $metas
 * @property-read int|null $metas_count
 * @property-read \App\Models\Project $project
 */
class Column extends Model
{

    use ProjectTrait;

    protected $fillable = [
        'project_id',
        'prev_id',
        'next_id',
        'title',
        'description',
        'frozen',
        'hidden',
        'type',
    ];
    
    public function metas()
    {
        return $this->hasMany(ColumnMeta::class);
    }

    public function cells()
    {
        return $this->hasMany(Cell::class);
    }
}
